package com.sentiment.database.bean;

import java.util.Date;

import org.bson.Document;import org.bson.types.ObjectId;

/**
 * @author 冉冉
 *
 */
public class PageInfo  {
	@Override
	public String toString() {
		return "PageInfo [_id=" + _id + ", inputInfo_id=" + inputInfo_id + ", title=" + title + ", url=" + url
				+ ", pragiarism=" + pragiarism + ", pageView=" + pageView + ", releaseTime=" + releaseTime + ", source="
				+ source + "]";
	}


	public static final String dbName = "PlagiarismDB";
	public static final String collection = "PageInfo";
	
	private ObjectId _id;
	private String inputInfo_id;
	private String title;
	private String url;
	private Double pragiarism;
	private Integer pageView;
	private Date releaseTime;
	private String source;
	
	public PageInfo(Document doc){
		super();
		_id = doc.getObjectId("_id");
		inputInfo_id = doc.getString("inputInfo_id");
		title = doc.getString("title");
		url = doc.getString("url");
		pragiarism = doc.getDouble("pragiarism");
		pageView = doc.getInteger("pageView");
		releaseTime = doc.getDate("releaseTime");
		source = doc.getString("source");
		
	}
	
	
	public PageInfo(String inputInfo_id, String title, String url, Double pragiarism, Integer pageView,
			Date releaseTime, String source) {
		super();
		this.inputInfo_id = inputInfo_id;
		this.title = title;
		this.url = url;
		this.pragiarism = pragiarism;
		this.pageView = pageView;
		this.releaseTime = releaseTime;
		this.source = source;
	}


	public Document toDocument(){
		return new Document("title",title).append("inputInfo_id", inputInfo_id)
				.append("url", url).append("pragiarism", pragiarism).append("pageView", pageView).append("releaseTime", releaseTime).append("source", source);
	}


	public String get_id() {
		return _id.toString();
	}


	public void set_id(String _id) {
		this._id = new ObjectId(_id);
	}


	public String getInputInfo_id() {
		return inputInfo_id;
	}


	public void setInputInfo_id(String inputInfo_id) {
		this.inputInfo_id = inputInfo_id;
	}


	public String getTitle() {
		return title;
	}


	public void setTitle(String title) {
		this.title = title;
	}


	public String getUrl() {
		return url;
	}


	public void setUrl(String url) {
		this.url = url;
	}


	public Double getPragiarism() {
		return pragiarism;
	}


	public void setPragiarism(Double pragiarism) {
		this.pragiarism = pragiarism;
	}


	public Integer getPageView() {
		return pageView;
	}


	public void setPageView(Integer pageView) {
		this.pageView = pageView;
	}


	public Date getReleaseTime() {
		return releaseTime;
	}


	public void setReleaseTime(Date releaseTime) {
		this.releaseTime = releaseTime;
	}


	public String getSource() {
		return source;
	}


	public void setSource(String source) {
		this.source = source;
	}
	
	
}
